#! -*- coding: utf-8 -*-

from script_utils import query, oid2nid
from script_utils import models

cols = {
    "feedback_cols": [
        "id",
        "content",
        "email",
        "date_added",
    ],
}


def migrate_feedback():
    for row in query('vacation_feedback', cols=cols['feedback_cols']):
        obj = dict(zip(cols['feedback_cols'], row))
        oid = obj['id']
        obj['id'] = oid2nid["vacation_feedback"][oid]
        models.Feedback.objects.create(**obj)


if __name__ == "__main__":
    print 'migrate vacation_feedback start...'
    migrate_feedback()
    print 'migrate vacation_feedback end...'


